import { ResPage, User, Login, Role } from '@/api/interface/index';
import http from '@/api';
import { sysCode } from '@/api/config/systemCode';
/**
 * @name 用户管理模块
 */
// 获取用户列表
export const getUserList = params => {
  return http.post<ResPage<User.ResUserList>>(`/user/page`, params);
};

// 新增用户
export const userSave = params => {
  return http.post(`/user/register`, params);
};

// 管理员修改用户密码
export const userUpPasswordManager = params => {
  return http.post(`/user/upPasswordManager`, params);
};

// 用户修改密码
export const userUpPasswordByUser = params => {
  return http.post(`/user/upPasswordUser`, params);
};

// 启用
export const userEnable = params => {
  return http.post(`/user/enable`, params);
};

// 禁用用户
export const userDisable = params => {
  return http.post(`/user/disable`, params);
};

// 修改用户其他信息
export const userUpdate = params => {
  return http.post(`/user/update`, params);
};

// 角色列表
export const roleList = params => http.post(`/role/page`, params);

// 角色新增
export const roleSave = params => http.post(`/role/add`, params);

// 角色新增
export const roleUpdate = params => http.post(`/role/update`, params);

// 角色删除
export const roleRemove = params => http.post(`/role/delete`, params);

// 为角色添加用户
export const userRoleAdd = params => http.post(`/userRole/add`, params);

// 分页查询角色下用户列表
export const userRolePageUserByRole = params => http.post(`/userRole/pageUserByRole`, params);

// 查询角色下的权限列表
export const userRoleListByRole = params => http.post(`/userRole/listByRole`, params);

// 为角色添加权限
export const rolePermissionAdd = params => http.post(`/rolePermission/add`, params);
// 查询角色下的权限列表
export const rolePermissionListByRole = params => http.post(`/rolePermission/listByRole`, params);

// 角色下删除用户
export const userRoleDelete = params => http.post(`/userRole/delete`, params);

// 为角色添加用户(追加)
export const userRoleAddByAppend = params => http.post(`/userRole/addByAppend`, params);
